package org.sklse.learningassistant.dao;

import java.util.List;

import javax.annotation.Resource;

import org.sklse.learningassistant.bean.Wish;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;

@Repository
public class WishDao {

	@Resource
	private JdbcTemplate jdbcTemplate;

	public List<Wish> getWish() {

		String sql = "select *from wish";
		RowMapper<Wish> rowMapper = new BeanPropertyRowMapper<>(Wish.class);
		List<Wish> wishList = jdbcTemplate.query(sql, new Object[] {}, rowMapper);

		return wishList;
	}

}
